def max_value(pointers):
    #对点集按照从小到大排序
    pointers.sort(key=lambda x:x[0])
    print(pointers)
    #按照y轴从小到大排序存放在Y中
    Y=pointers[:]
    Y.sort(key=lambda y:y[1])
    print(Y)
def CPair(i,j,pointers,Y):
    m=j-i+1
    if m<3:
        return None
    YL=Y[i:i+(int(m/2))]
    YR=Y[i+(int(m/2)):j]
    (d1,pr,ps)=CPair(i,i+(int(m/2)-1),pointers,YL)
    (d2,pr1,ps1)=CPair(i+int(m/2),j,pointers,YR)



n=int(input())
    # nums=list(map(int,input().split()))
pointers=[]
for i in range(n):
    x,y=map(int,input().split())
    pointers.append([x,y])
print(pointers)
max_value(pointers)
    # print(nums)
    # max_value(n,nums)



